import axios from "axios";
let token = `Bearer ${JSON.parse(window.sessionStorage.getItem("user") as any).token}`;
//异步获取子接口的参数变化
export async function asyncData1(type: any, fondsId: any) {
  return await axios.get("/api/api/FondsCopy/LoadClasss", {
    params: {
      type: type,
      fondsId: fondsId
    },
    headers: {
      Authorization: token
    }
  });
}

export async function asyncData2(type: any, fondsId: any, classId: any) {
  return await axios.get("/api/api/FondsCopy/LoadFM", {
    params: {
      type: type,
      fondsId: fondsId,
      classId: classId
    },
    headers: {
      Authorization: token
    }
  });
}

export async function asyncData3(type: any, fmId: any) {
  return await axios.get("/api/api/FondsCopy/LoadFMLower", {
    params: {
      type: type,
      fmId: fmId
    },
    headers: {
      Authorization: token
    }
  });
}

export async function asyncData4(type: any, fmId: any, fatherId: any, wdKey: any) {
  return await axios.get("/api/api/FondsCopy/LoadCatalog", {
    params: {
      type: type,
      fmId: fmId,
      fatherId: fatherId,
      wdKey: wdKey
    },
    headers: {
      Authorization: token
    }
  });
}

export async function asyncData5(type: any, fmtId: any, tableName: any) {
  return await axios.get("/api/api/FondsCopy/LoadFMTLower", {
    params: {
      type: type,
      fmtId: fmtId,
      tableName: tableName
    },
    headers: {
      Authorization: token
    }
  });
}

export async function asyncData10(type: any, fmId: any, fatherId: any) {
  return await axios.get("/api/api/FondsCopy/LoadReportModule", {
    params: {
      type: type,
      fmId: fmId,
      fatherId: fatherId
    },
    headers: {
      Authorization: token
    }
  });
}

export async function asyncDataMore(type: any, fmtId: any, tableName: any, nodeType: any, fatherId: any) {
  return await axios.get("/api/api/FondsCopy/LoadTable", {
    params: {
      type: type,
      fmtId: fmtId,
      tableName: tableName,
      nodeType: nodeType,
      fatherId: fatherId
    },
    headers: {
      Authorization: token
    }
  });
}
export default {
  asyncData1,
  asyncData2,
  asyncData3,
  asyncData4,
  asyncData5,
  asyncData10,
  asyncDataMore
};
